package ua.mk.chdu.rtem.diploma.core.agents.scheduling.behaviours;

import jade.core.behaviours.OneShotBehaviour;
import jade.core.behaviours.SequentialBehaviour;
import ua.mk.chdu.rtem.diploma.core.agents.scheduling.TaskSchedulingAgent;

public class ProcessCycle extends SequentialBehaviour {

    private TaskSchedulingAgent agent;

    public ProcessCycle(TaskSchedulingAgent a) {
        super(a);
        agent = a;
        initiateBehavioursSequence();
    }

    private void initiateBehavioursSequence() {
        addSubBehaviour(new ReceivePerformanceReportBehaviour(agent));
        addSubBehaviour(new MainRequestReceivingBehaviour(agent));
        addSubBehaviour(new OneShotBehaviour() {
            @Override
            public void action() {
                System.out.println("STEP 3");
            }
        });
        addSubBehaviour(new OneShotBehaviour() {
            @Override
            public void action() {
                System.out.println("STEP 4");
            }
        });
    }

    @Override
    public int onEnd() {
        reset();
        agent.addBehaviour(this);
        return super.onEnd();
    }
}
